package com.dragon.speech.common.config;

import com.google.common.base.Throwables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * Created by <a href='http://yulin.io'>hyl<a> on 2017/6/26 16:51.
 */
@ControllerAdvice
public class GlobalExceptionHandler {
    private static Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);

    @ExceptionHandler(value = Exception.class)
    public void errorHandler(Exception e) {
        logger.error("运行时异常：{}", Throwables.getStackTraceAsString(e));
    }
}
